package c.c.a;

import android.content.Context;
import android.text.TextUtils;
import c.e.a.b.a.a.a;
import java.util.Objects;
import org.json.JSONObject;

public class f2 extends b2 {
    public final Context e;
    public final g2 f;

    public f2(Context context, g2 g2Var) {
        super(false, false);
        this.e = context;
        this.f = g2Var;
    }

    public boolean b(JSONObject jSONObject) {
        jSONObject.put("sdk_version", 336);
        jSONObject.put("sdk_version_name", "3.6.0-rc.8-embed");
        jSONObject.put("channel", this.f.b.getChannel());
        c.b(jSONObject, "aid", this.f.b.getAid());
        c.b(jSONObject, "release_build", this.f.b.getReleaseBuild());
        c.b(jSONObject, "app_region", this.f.b.getRegion());
        c.b(jSONObject, "app_language", this.f.b.getLanguage());
        c.b(jSONObject, "user_agent", this.f.e.getString("user_agent", null));
        c.b(jSONObject, "ab_sdk_version", this.f.c.getString("ab_sdk_version", ""));
        c.b(jSONObject, "ab_version", this.f.c());
        c.b(jSONObject, "aliyun_uuid", this.f.b.getAliyunUdid());
        CharSequence googleAid = this.f.b.getGoogleAid();
        if (TextUtils.isEmpty(googleAid)) {
            Context context = this.e;
            g2 g2Var = this.f;
            if (TextUtils.isEmpty(l0.a)) {
                synchronized (l0.class) {
                    if (TextUtils.isEmpty(l0.a)) {
                        String str;
                        try {
                            str = a.b(context).a;
                        } catch (Throwable th) {
                            if (!(th instanceof ClassNotFoundException)) {
                                if (!(th instanceof NoClassDefFoundError)) {
                                    th.printStackTrace();
                                }
                            }
                            str = null;
                        }
                        if (TextUtils.isEmpty(str)) {
                            str = g2Var.e.getString("google_aid", null);
                        } else if (!(TextUtils.equals(g2Var.e.getString("google_aid", null), str) || TextUtils.isEmpty(str))) {
                            if (context != null) {
                                g2Var.e.edit().putString("google_aid", str).apply();
                            }
                        }
                        l0.a = str;
                    } else {
                        googleAid = l0.a;
                    }
                }
            }
            googleAid = l0.a;
        }
        if (!TextUtils.isEmpty(googleAid)) {
            c.b(jSONObject, "google_aid", googleAid);
        }
        Objects.requireNonNull(this.f);
        if (!TextUtils.isEmpty(null)) {
            try {
                jSONObject.put("app_track", new JSONObject(null));
            } catch (Throwable th2) {
                m0.b(th2);
            }
        }
        String string = this.f.c.getString("header_custom_info", null);
        if (string != null && string.length() > 0) {
            jSONObject.put("custom", new JSONObject(string));
        }
        c.b(jSONObject, "user_unique_id", this.f.c.getString("user_unique_id", null));
        return true;
    }
}
